# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html

class WeixinDataPipeline(object):
    def process_item(self, item, spider):
        if spider.name=="listspider":
            sql="INSERT INTO weixin_data(title,comment_id,content_url,publish_time) VALUES (:title,:comment_id,:content_url,:publish_time);"
        else:
            sql="update weixin_data set content_text=:content_text where id=:id"
        spider.conn.execute(sql,item)
        return item
